//
//  library
//
//  Created by Rui Carmo on 2007-03-20.
//  Copyright (c) 2007 __MyCompanyName__. All rights reserved.
//

http://www.pengoworks.com/workshop/jquery/autocomplete.htm
http://www.dyve.net/jquery/?autocomplete
http://php.scripts.psu.edu/rja171/widgets/autocomplete.php

livesearch = {
  t: 0,
  doit: function() {
    $('#livesearch-spinner').css('visibility','visible');
    $('#livesearch-form').form('#livesearch-msg',  function(){
      $('#livesearch-spinner').css('visibility','hidden');
    });
  },
  init: function(){
    $('#livesearch-q').set('autocomplete', 'off');
    $('#livesearch-q').hover(function(){
      this.focus();
      $(this).css('border','2px solid #0a0');
      $(this).keyup(function(){
        if (this.t) clearTimeout(this.t);
        this.t = setTimeout("livesearch.doit()", 1000);
      });
    });
    $('#livesearch-q').blur(function(){
      $(this).css('border','2px solid #ccc');
      $('#livesearch-spinner').css('visibility','hidden');
    });
  }
}